<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!-- 定义全局变量描述站点名 -->
<c:set var="ctx" value="${pageContext.servletContext.contextPath}" />
<! DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>修改密码 - 人事管理系统</title>
<link rel="icon" href="${ctx}/favicon.ico" type="image/ico">
<meta name="keywords" content="人事管理系统">
<meta name="description" content="人事管理系统">
<meta name="author" content="yinqi">
<link href="${ctx}/css/bootstrap.min.css" rel="stylesheet">
<link href="${ctx}/css/materialdesignicons.min.css" rel="stylesheet">
<link href="${ctx}/css/style.min.css" rel="stylesheet">
</head>

<body>
	<div class="lyear-layout-web">
		<div class="lyear-layout-container">

			<jsp:include page="left.jsp"></jsp:include>
			<!--End 左侧导航-->
			<jsp:include page="header.jsp"></jsp:include>

			<!--页面主要内容-->
			<main class="lyear-layout-content">

				<div class="container-fluid">

					<div class="row">
						<div class="col-lg-12">
							<div class="card">
								<div class="card-body">
									<div class="form-group">
										<label for="old-password">原密码</label> <input type="password"
											class="form-control" name="oldpwd" id="oldpwd"
											placeholder="输入账号的原登录密码">
									</div>
									<div class="form-group">
										<label for="new-password">新密码</label> <input type="password"
											class="form-control" name="newpwd" id="newpwd"
											placeholder="输入新的密码">
									</div>
									<div class="form-group">
										<label for="confirm-password">确认新密码</label> <input
											type="password" class="form-control" name="confirmpwd"
											id="confirmpwd" placeholder="请再次输入新密码">
									</div>
									<button type="button" class="btn btn-primary"
										onclick="modifyPWD()">确认修改</button>
								</div>
							</div>
						</div>

					</div>

				</div>

			</main>
			<!--End 页面主要内容-->

		</div>
	</div>

	<script type="text/javascript" src="${ctx}/js/jquery.min.js"></script>
	<script type="text/javascript" src="${ctx}/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="${ctx}/js/perfect-scrollbar.min.js"></script>
	<script type="text/javascript" src="${ctx}/js/main.min.js"></script>
	<!--消息提示-->
	<script src="js/bootstrap-notify.min.js"></script>
	<script type="text/javascript" src="js/lightyear.js"></script>
	<script type="text/javascript">
		//修改密码
		function modifyPWD() {
			var oldp = $("#oldpwd").val();
			var newp = $("#newpwd").val();
			var confirmp = $("#confirmpwd").val();
			lightyear.loading('show');
			$.getJSON("modifyPBOP", {
				"oldp" : oldp,
				"newp" : newp,
				"confirmp" : confirmp
			}, function(data) {
				if (data.msg == "success") { //修改成功
					lightyear.loading('hide');
					lightyear.notify('修改成功~', 'success', 1000);
				} else if (data.msg == "fail") { //存在空数据
					lightyear.loading('hide');
					lightyear.notify('请勿输入空数据!', 'danger', 1000);
				} else if (data.msg == "byz") { //新密码输入不一致
					lightyear.loading('hide');
					lightyear.notify('新密码输入不一致!', 'danger', 1000);
				} else if (data.msg == "repeat") { //新密码输入不一致
					lightyear.loading('hide');
					lightyear.notify('新密码与原密码一致!', 'warning', 1000);
				} else { //原密码输入错误
					lightyear.loading('hide');
					lightyear.notify('原密码输入错误!', 'danger', 1000);
				}
				//清空填写的数据
				$("#oldpwd").val("");
				$("#newpwd").val("");
				$("#confirmpwd").val("");
			});
		};
	</script>
</body>
</html>